package zuoye4;
class Draw{
    private int gd;
    public Draw(int gd) {
        if (gd<=3){
            System.out.println("高度必须大于3，请重新构建");
        }
        else{
            this.gd = gd;
        }
    }
    public void sjx(){
        System.out.println("三角形:");
        for(int i=0;i<gd;i++){
            for (int x=i+1;x>0;x--){
                System.out.print("*");
            }
            System.out.println();
        }
        System.out.println();
    }
    public void jx(){
        System.out.println("矩形:");
        for(int i=0;i<gd;i++){
            System.out.println("****");
        }
        System.out.println();
    }
    public void zfx(){
        System.out.println("正方形:");
        for(int i=0;i<gd;i++){
            for(int j=0;j<gd;j++){
                System.out.print("*");
            }
            System.out.println();
        }
        System.out.println();
    }
    public void px(){
        System.out.println("平行四边形:");
        for(int i=0;i<gd;i++){
            for(int j=0;j<gd-i;j++){
                System.out.print(" ");
            }
            for(int j=0;j<gd;j++){
                System.out.print("*");
            }
            System.out.println();
        }
        System.out.println();
    }
}
public class zuoye4 {
    public static void main(String[] args) {
        Draw d1=new Draw(5);
        d1.sjx();
        d1.jx();
        d1.zfx();
        d1.px();
    }
}
